/*
 * @Author: Leng
 * @Date: 2022-11-07 18:31:39
 * @Description: 地图
 * @FilePath: \vue-leng\src\config\map\index.js
 */
import Location_app from './map.app.js'
import Location_wx from './map.wx.js'
import Location_dd from './map.dd.js'
import Location_web from './map.web.js'
import Location_feishu from './map.feishu'
import Location_ip from './map.ip.js'
import Location_workwx from './map.workwx.js'
window.initUrl = location.href
export default function () {
  if ($jump.env.dd) { // 钉钉环境
    console.log('dd')
    // return new Location_web()
    return new Location_dd()
  } else if ($jump.env.miniprogram) { // 小程序中使用ip定位
    console.log('ip')
    // return new Location_ip()
    return new Location_web()
  } else if ($jump.env.weixin) { // 微信
    console.log('wx')
    return new Location_wx()
  } else if ($jump.env.wxwork) {
    console.log('wxwork')
    return new Location_workwx()
    // return new Location_web()
  } else if ($jump.env.feishu) {
    console.log('feishu')
    return new Location_feishu()
  } else if (window.api && !window.api.statusBarAppearance && api.systemType === 'ios') {
    console.log('web11')
    return new Location_web()
  } else if (window.api) { // app
    console.log('app')
    return new Location_app()
  } else { // web
    console.log('web')
    return new Location_web()
  }
}

export function changeByType(type) {
  if ($jump.env.dd) { // 钉钉环境
    console.log('dd')
    // return new Location_web()
    return new Location_dd()
  } else if ($jump.env.miniprogram) { // 小程序中使用ip定位
    console.log('ip')
    // return new Location_ip()
    return new Location_web()
  } else if ($jump.env.weixin || type === 'weixin') { // 微信
    console.log('wx')
    return new Location_wx()
  } else if ($jump.env.wxwork || type === 'wxwork') {
    console.log('wxwork')
    return new Location_workwx()
    // return new Location_web()
  } else if ($jump.env.feishu) {
    console.log('feishu')
    return new Location_feishu()
  } else if (window.api && !window.api.statusBarAppearance && api.systemType === 'ios') {
    console.log('web11')
    return new Location_web()
  } else if (window.api) { // app
    console.log('app')
    return new Location_app()
  } else { // web
    console.log('web')
    return new Location_web()
  }
}